#define _POSIX_SOURCE
#include <stdio.h>
#include <unistd.h>    //close函数头文件
#include <sys/types.h> //open函数头文件
#include <sys/stat.h>  //open函数头文件
#include <fcntl.h>     //flags参数头文件
#include <elf.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
static struct sigaction sigaction_sigup;
int main()
{

    pid_t pid = fork();
    if (pid == -1)
    {
        perror(strerror(errno));
        exit(errno);
    }
    if (pid != 0)
    exit(0);
    
    printf("%d\n", getpid());
    sigemptyset(&sigaction_sigup.sa_mask);
    sigaction_sigup.sa_handler = SIG_IGN;
    sigaction_sigup.sa_flags=0;

    sigaction(SIGHUP,&sigaction_sigup,NULL);
    while (1)
    {
        /* code */
        sleep(1);
    }
    
    
}